/* 
统计一个数字在排序数组中出现的次数。

输入: nums = [5,7,7,8,8,10], target = 8
输出: 2


思路：

*/

/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number}
 */
 var search = function(nums, target) {
    let count=0
    for (const val of nums) {
        if(val===target){
            count++
        }
    }
    return count
};

let nums = [5,7,7,8,8,10], target = 8

let res = search(nums,target)
console.log(res);